package com.bwie.es;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.bwie.pojo.TbUser;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.DateFormat;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.io.Serializable;
import java.util.Date;

/**
 * @author 军哥
 * @version 1.0
 * @description: TODO
 * @date 2025/5/7 14:29
 */

@Data
@Document(indexName = "es_order",shards = 1,replicas = 0)
public class EsOrder implements Serializable {
    /**
     * 订单ID
     */
    @Id
    @Field(type = FieldType.Keyword)
    private Integer orderId;

    /**
     * 订单编号
     */
    @Field(type = FieldType.Text, analyzer = "ik_max_word")
    private String orderCode;

    /**
     * 订单金额
     */
    @Field(type = FieldType.Double)
    private Double amount;

    /**
     * 下单时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8", shape = JsonFormat.Shape.STRING)
    @Field(type = FieldType.Date, format = DateFormat.custom, pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;

    /**
     * 消费者ID
     */
    @Field(type = FieldType.Integer)
    private Integer userId;

    /**
     * 产品数量
     */
    @Field(type = FieldType.Integer)
    private Integer prodCount;

    /**
     * 订单状态：0未支付1已支付2已退款3已发货4已收货
     */
    @Field(type = FieldType.Integer)
    private Integer orderStatus;


    @Field(type = FieldType.Text, analyzer = "ik_max_word")
    private String nickName;

    private static final long serialVersionUID = 1L;
}
